package com.xcj.cloud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xcj.cloud.entity.Comment;
import com.xcj.cloud.mapper.CommentMapper;
import com.xcj.cloud.service.CommentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {
    @Resource
    private CommentMapper commentMapper;
    @Override
    public int insertOneComment(Comment comment) {
        return commentMapper.insert(comment);
    }

    @Override
    public List<Comment> getAllComment() {
        return commentMapper.getAllComment();
    }

    public List<Comment> selectCommentByHid(long hid){
        QueryWrapper<Comment> queryWrapper = new QueryWrapper();
        queryWrapper.eq("hid",hid);
        return  commentMapper.selectList(queryWrapper);
    }

}
